package net.hn.hnms.biz.job.service;

import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import net.hn.hnms.biz.job.utils.HttpUtil;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class PlanService {

    /**
     * 多服务调用
     */
    @XxlJob("longRuanServiceHandler")
    public void longRuanServiceHandler() throws Exception {
        XxlJobHelper.log("执行开始");

        XxlJobHelper.log("获取龙软销售数据-开始");
        XxlJobHelper.log(HttpUtil.sendHttpGet("http://10.244.136.111:8080/plan/group/getSaleStatisticByDate"));
        XxlJobHelper.log("获取龙软销售数据-结束");

        XxlJobHelper.log("获取龙软产量数据-开始");
        XxlJobHelper.log(HttpUtil.sendHttpGet("http://10.244.136.111:8080/plan/group/getProductionDataByDate"));
        XxlJobHelper.log("获取龙软产量数据-结束");

//        XxlJobHelper.log("获取龙软进尺数据-开始");
//        XxlJobHelper.log(HttpUtil.sendHttpGet("http://10.244.136.111:8080/plan/group/getFootageData"));
//        XxlJobHelper.log("获取龙软进尺数据-结束");

        XxlJobHelper.log("执行完毕");

    }


    @XxlJob("longRuanJinChiServiceHandler")
    public void longRuanJinChiServiceHandler() throws Exception {
        XxlJobHelper.log("执行开始----------------------");
        System.out.println("执行开始----------------------");

        XxlJobHelper.log("获取龙软进尺数据-开始");
        XxlJobHelper.log(HttpUtil.sendHttpGet("http://10.244.136.111:8080/plan/group/getFootageData"));
        XxlJobHelper.log("获取龙软进尺数据-结束");

        XxlJobHelper.log("执行完毕--------------------");

    }

    @XxlJob("longRuanGetProductionAndSaleData")
    public void longRuanGetProductionAndSaleData() throws Exception {
        XxlJobHelper.log("执行开始");
        XxlJobHelper.log(HttpUtil.sendHttpGet("http://10.244.136.111:8080/plan/group/getProductionAndSaleData"));
        XxlJobHelper.log("执行完毕");

    }

    /**
     * 获取环保监测月度考核排名
     * @throws Exception
     */
    @XxlJob("huanBaoGetMonthlyAssessmentRanking")
    public void huanBaoGetMonthlyAssessmentRanking() throws Exception {
        XxlJobHelper.log("执行开始");
        XxlJobHelper.log(HttpUtil.sendHttpGet("http://10.244.136.111:8080/plan/group/getMonthlyAssessmentRanking"));
        XxlJobHelper.log("执行完毕");

    }

    /**
     * 获取环保监测传输有效率
     * @throws Exception
     */
    @XxlJob("huanBaoGetEfficientTransmission")
    public void huanBaoGetEfficientTransmission() throws Exception {
        XxlJobHelper.log("执行开始");
        XxlJobHelper.log(HttpUtil.sendHttpGet("http://10.244.136.111:8080/plan/group/getEfficientTransmission"));
        XxlJobHelper.log("执行完毕");

    }

    @XxlJob("longRuanGetSafetyAlarmData")
    public void longRuanGetSafetyAlarmData() throws Exception {
        XxlJobHelper.log("获取龙软安全监控报警列表执行开始");
        XxlJobHelper.log(HttpUtil.sendHttpGet("http://10.244.136.111:8080/safety/group/riskMonitor/monitor/getLongRuanAlarmList",60000));
        XxlJobHelper.log("获取龙软安全监控报警列表执行完毕");

    }
}
